export const now = new Date();
export const nowYear = (now.getFullYear()).toString();
export const nowMonth = (now.getMonth()+1).toString();
export const tableOption = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  dialogWidth: '70%',
  delBtn: false,
  addBtn: false,
  editBtn: false,
  viewBtn: true,
  selection: true,
  labelWidth: 120,
  searchMenuSpan: 6,
  // selectable: row => {
  //   return row.checkSubmit == '0' || row.checkStatus == '1'
  // },
  column: [{
    label: '标识',
    prop: 'id',
    hide: true,
    display: false
  }, {
    label: '单号',
    prop: 'numbers',
    display: false,
    search: true,
  },  {
    label: '年份',
    prop: 'workTime',
    type: 'year',
    format: 'yyyy',
    valueFormat: 'yyyy',
    search: true,
    searchValue: nowYear, 
    display: false
  }, {
    label: '月份',
    prop: 'planMonth',
    search: true,
    searchValue: nowMonth, 
    display: false,
    formatter: (row, value, label, column) => {
      if (value) {
        return value.split(',').map(m => m + '月').join(',')
      }
    },
  }, {
    label: '周',
    prop: 'planWeek',
    type: 'select',
    dicUrl: '/admin/dict/type/plan_week_cycle',
    display: false
  }, {
    label: '计划完成时间',
    prop: 'planFinishTime',
    type: 'date',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    display: false
  },{
    label: '日计划审批状态',
    prop: 'checkApproveStatus',
    type: 'select',
    dicUrl: '/admin/dict/type/check_approve_status',
	search: true,
	searchLabelWidth: 120,
    display: false
  }, {
    label: '票种',
    prop: 'ticketType',
    type: 'select',
    dicUrl: '/support/swpmticketcardtype/dict',
    props: {
      label: 'mainName',
      value: 'mainEnName'
    },
    cascaderItem: ["ticketName"],
    search: true,
    display: false,
    rules: [{
      required: true,
      message: '请选择票种',
      trigger: 'blur'
    }]
  }, {
    "type": "select",
    "label": "车票名称",
    "prop": "ticketName",
    props: {
      label: 'subName',
      value: 'subEnName'
    },
    dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}',
    dicFlag: false,
    search: true,
    display: false
  }, {
    label: '票价',
    prop: 'ticketPrice',
    type: 'number',
    precision: 2,
    display: false
  }, {
    label: '车票次数',
    prop: 'ticketTimes',
    type: 'number',
    precision: 0,
    display: false
  }, {
    label: '车票有效期',
    prop: 'activeTime',
    // type: 'number',
    // precision: 0,
    display: false
  }, {
    label: '车票最晚使用时间',
    prop: 'latestStartTime',
    type: 'datetime',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    display: false
  }, {
    label: '张数',
    prop: 'ticketNumber',
    type: 'number',
    precision: 0,
    display: false
  }, {
    label: '车票用途',
    prop: 'ticketPurpose',
    display: false,
    hide: true
  },
  {
    "type": "select",
    "label": "线路",
    "prop": "lineCode",
    cascaderItem: ["stationCode"],
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/support/swparamline/dict",
    rules: [{
      required: true,
      message: '请选择线路'
    }],
    width: 120,
    display: false
  }, {
    "type": "select",
    "label": "车站",
    "prop": "stationCode",
    props: {
      label: 'name',
      value: 'code'
    },
    dicUrl: "/support/swparamstation/dict/{{key}}",
    rules: [{
      required: true,
      message: '请选择车站'
    }],
    width: 120,
    cell: true,
    display: false
  }, {
    label: '实际完成时间',
    prop: 'actualFinishTime',
    type: 'date',
    valueFormat: 'yyyy-MM-dd HH:mm:ss',
    search: true,
    searchLabelWidth: 100,
    display: false
  }, {
    label: '实际配送数量',
    prop: 'distribuNumber',
    type: 'number',
    precision: 0,
    display: false
  }, {
    label: '配送人1',
    prop: 'personName',
    type: 'select',
    component: 'user-select',
    params: {
      userCodeKey: 'personId'
    },
    display: false
  }, {
    label: '配送人1工号',
    prop: 'personId',
    display: false
  }, {
    label: '配送人2',
    prop: 'personTwoName',
    type: 'select',
    component: 'user-select',
    params: {
      userCodeKey: 'personTwoId'
    },
    display: false
  }, {
    label: '配送人2工号',
    prop: 'personTwoId',
    display: false
  }, {
    label: '是否完成配送',
    prop: 'isFinish',
    type: 'select',
    search: true,
    searchLabelWidth: 100,
    dicData: [{
      label: '是',
      value: '1'
    }, {
      label: '否',
      value: '0'
    }],
    display: false
  },
  {
    label: '数据来源',
    prop: 'dataSource',
    type: 'select',
    dicData: [{
      label: '周计划分解',
      value: '0'
    }, {
      label: '无效票',
      value: '1'
    }, {
      label: '公务票',
      value: '2'
    }, {
      label: '临时计划',
      value: '3'
    }],
    display: false
  }, {
    label: '未完成情况说明',
    prop: 'unfinishReason',
    display: false
  },  {
    label: '审批状态',
    prop: 'checkStatus',
    type: 'select',
    dicUrl: '/admin/dict/type/check_status',
    display: false
  }, {
    label: '审核人',
    prop: 'checkPersonId',
    hide: true,
    display: false
  }, {
    label: '审核人',
    prop: 'checkPersonName',
    display: false,
    search: true,
  }, {
    label: '审核时间',
    prop: 'checkTime',
    hide: false,
    display: false
  }, {
    label: '运营商',
    prop: 'operator',
    display: false,
    search: true
  },{
    label: '备注',
    prop: 'remark',
    type: 'textarea',
    maxRows: 6,
    minRows: 4,
    display: false
  }, {
    label: '创建人ID',
    prop: 'creatorId',
    hide: true,
    display: false
  }, {
    label: '创建人名称',
    prop: 'creatorName',
    hide: true,
    display: false
  }, {
    label: '创建时间',
    prop: 'createtime',
    hide: true,
    display: false
  }],
  group: [{
    label: '车票配送计划信息',
    column: [{
      label: '年份',
      prop: 'workTime',
      type: 'year',
      format: 'yyyy',
      valueFormat: 'yyyy',
      disabled: true
    }, {
      label: '单号',
      prop: 'numbers',
      disabled: true,
    },{
      label: '月份',
      prop: 'planMonth',
      disabled: true
    }, {
      label: '周',
      prop: 'planWeek',
      disabled: true
    }, {
      label: '票种',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
      disabled: true
    }, {
      "type": "select",
      "label": "车票名称",
      "prop": "ticketName",
      props: {
        label: 'subName',
        value: 'subEnName'
      },
      disabled: true,
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}'
    }, {
      label: '票价',
      prop: 'ticketPrice',
      type: 'number',
      precision: 2,
      disabled: true
    }, {
      label: '车票次数',
      prop: 'ticketTimes',
      type: 'number',
      precision: 0,
      disabled: true
    }, {
      label: '车票有效期',
      prop: 'activeTime',
      // type: 'number',
      // precision: 0,
      disabled: true
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: false
    }, {
      label: '张数',
      prop: 'ticketNumber',
      type: 'number',
      precision: 0,
      disabled: true
    }, {
      label: '车票用途',
      prop: 'ticketPurpose',
      disabled: true,
      display: false
    }, {
      label: '计划完成时间',
      prop: 'planFinishTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: true
    }, {
      label: '配送人1',
      prop: 'personName',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'personId'
      }
    }, {
      label: '配送人1工号',
      prop: 'personId',
      disabled: true
    }, {
      label: '配送人2',
      prop: 'personTwoName',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'personTwoId'
      }
    }, {
      label: '配送人2工号',
      prop: 'personTwoId',
      disabled: true
    }]
  }, {
    label: '车票配送实际信息',
    column: [{
      label: '实际完成时间',
      prop: 'actualFinishTime',
      type: 'date',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: true
    }, {
      label: '起号/止号',
      prop: 'startEndNo',
      disabled: true
    }, {
      label: '实际配送数量',
      prop: 'distribuNumber',
      type: 'number',
      precision: 0,
      disabled: true
    }, {
      label: '差异数量',
      prop: 'differenceNumber',
      type: 'number',
      disabled: true
    }]
  }, {
    label: '未完成情况说明',
    column: [{
      label: '未完成情况说明',
      prop: 'unfinishReason',
      type: 'textarea',
      span: 24,
      disabled: true
    }]
  }, {
    label: '审批内容',
    editDisplay: false,
    column: [{
      label: '审批状态',
      type: "select",
      prop: 'checkStatus',
      dicUrl: '/admin/dict/type/check_status',
      editDisplay: false,
      span: 24
    }, {
      label: '审批建议',
      prop: 'checkSuggest',
      type: 'textarea',
      editDisplay: false,
      span: 24
    }]
  }]
};

export const tableOptionEditPlan = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  labelWidth: 120,
  submitBtn: false,
  emptyBtn: false,
  group: [{
    label: '车票配送计划信息',
    column: [ {
      label: '单号',
      prop: 'numbers',
      disabled: true,
    }, {
      label: '月份',
      prop: 'planMonth',
      disabled: true
    }, {
      label: '周',
      prop: 'planWeek',
      disabled: true
    }, {
      label: '票种',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      }
    }, {
      "type": "select",
      "label": "车票名称",
      "prop": "ticketName",
      props: {
        label: 'subName',
        value: 'subEnName'
      },
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}'
    }, {
      label: '票价',
      prop: 'ticketPrice',
      type: 'number',
      precision: 2
    }, {
      label: '车票次数',
      prop: 'ticketTimes',
      type: 'number',
      precision: 0
    }, {
      label: '车票有效期',
      prop: 'activeTime',
      // type: 'number',
      // precision: 0
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss'
    }, {
      label: '张数',
      prop: 'ticketNumber',
      type: 'number',
      precision: 0
    }, {
      label: '车票用途',
      prop: 'ticketPurpose',
      disabled: true,
      display: false
    }, {
      label: '计划完成时间',
      prop: 'planFinishTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss'
    }, {
      label: '配送人1',
      prop: 'personName',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'personId'
      }
    }, {
      label: '配送人1工号',
      prop: 'personId',
      disabled: true
    }, {
      label: '配送人2',
      prop: 'personTwoName',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'personTwoId'
      }
    }, {
      label: '配送人2工号',
      prop: 'personTwoId',
      disabled: true
    }]
  }, {
    label: '车票配送实际信息',
    column: [{
      label: '实际完成时间',
      prop: 'actualFinishTime',
      type: 'date',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        required: true,
        message: '请选择实际完成时间',
        trigger: 'blur'
      }]
    }, {
      label: '起号/止号',
      prop: 'startEndNo'
    }, {
      label: '实际配送数量',
      prop: 'distribuNumber',
      type: 'number',
      precision: 0,
      rules: [{
        required: true,
        message: '请输入实际配送数量',
        trigger: 'blur'
      }]
    }, {
      label: '差异数量',
      prop: 'differenceNumber',
      type: 'number',
      disabled: true
    }]
  }, {
    label: '未完成情况说明',
    column: [{
      label: '未完成情况说明',
      prop: 'unfinishReason',
      type: 'textarea',
      span: 24
    }]
  }]
};

export const tableOptionCompleteInfo = {
  border: true,
  index: true,
  indexLabel: '序号',
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  labelWidth: 120,
  submitBtn: false,
  emptyBtn: false,
  group: [{
    label: '车票配送计划信息',
    column: [ {
      label: '单号',
      prop: 'numbers',
      disabled: true,
    }, {
      label: '月份',
      prop: 'planMonth',
      disabled: true
    }, {
      label: '周',
      prop: 'planWeek',
      disabled: true
    }, {
      label: '票种',
      prop: 'ticketType',
      type: 'select',
      dicUrl: '/support/swpmticketcardtype/dict',
      props: {
        label: 'mainName',
        value: 'mainEnName'
      },
      disabled: true
    }, {
      "type": "select",
      "label": "车票名称",
      "prop": "ticketName",
      props: {
        label: 'subName',
        value: 'subEnName'
      },
      disabled: true,
      dicUrl: '/support/swpmticketcardtypeparam/dictAll/{{key}}'
    }, {
      label: '票价',
      prop: 'ticketPrice',
      type: 'number',
      precision: 2,
      disabled: true
    }, {
      label: '车票次数',
      prop: 'ticketTimes',
      type: 'number',
      precision: 0,
      disabled: true
    }, {
      label: '车票有效期',
      prop: 'activeTime',
      // type: 'number',
      // precision: 0,
      disabled: true
    }, {
      label: '车票最晚使用时间',
      prop: 'latestStartTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: true
    }, {
      label: '张数',
      prop: 'ticketNumber',
      type: 'number',
      precision: 0,
      disabled: true
    }, {
      label: '车票用途',
      prop: 'ticketPurpose',
      disabled: true,
      display: false
    }, {
      label: '计划完成时间',
      prop: 'planFinishTime',
      type: 'date',
      format: 'yyyy-MM-dd',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      disabled: true
    }, {
      label: '配送人1',
      prop: 'personName',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'personId'
      },
      disabled: true
    }, {
      label: '配送人1工号',
      prop: 'personId',
      disabled: true
    }, {
      label: '配送人2',
      prop: 'personTwoName',
      type: 'select',
      component: 'user-select',
      params: {
        userCodeKey: 'personTwoId'
      },
      disabled: true
    }, {
      label: '配送人2工号',
      prop: 'personTwoId',
      disabled: true
    }]
  }, {
    label: '车票配送实际信息',
    column: [{
      label: '实际完成时间',
      prop: 'actualFinishTime',
      type: 'date',
      valueFormat: 'yyyy-MM-dd HH:mm:ss',
      rules: [{
        required: true,
        message: '请选择实际完成时间',
        trigger: 'blur'
      }]
    }, {
      label: '起号/止号',
      prop: 'startEndNo'
    }, {
      label: '实际配送数量',
      prop: 'distribuNumber',
      type: 'number',
      precision: 0,
      rules: [{
        required: true,
        message: '请输入实际配送数量',
        trigger: 'blur'
      }]
    }, {
      label: '差异数量',
      prop: 'differenceNumber',
      type: 'number',
      disabled: true
    }]
  }, {
    label: '未完成情况说明',
    column: [{
      label: '未完成情况说明',
      prop: 'unfinishReason',
      type: 'textarea',
      span: 24
    }]
  }]
};
